package cn.juque.singleton.hungry;

/**
 * @author juque
 * @version 1.0.0
 * <ul>
 *     <li>饿汉模式</li>
 * </ul>
 * @date 2023-06-12 23:41:15
 **/
public class Singleton {

    private static final Singleton INSTANCE = new Singleton();

    private Singleton() {
        System.out.println("我是饿汉，饿死啦！我要马上构建，不等你们啦！");
    }

    public static Singleton getInstance() {
        return INSTANCE;
    }

    public void hello() {
        System.out.println("你好呀！我是饿汉模式！");
        System.out.println("我在类装载时就实例化，基于classloder机制避免了多线程的同步问题！");
    }
}
